package com.example.demo.oo.domain.vo;

import com.example.demo.app.Validator;
import com.example.demo.oo.domain.Base;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;


@Data
public class Mobile extends Base<Mobile> {

    @NotBlank(message = "手机号码不能为空")
    @NotNull(message = "手机号码不能为空")
    @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "手机号格式不正确")
    //@JsonProperty("mobile")
    private String value;


    public void valid() {
        validator.validate(this);
    }

}
